package add;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import util.JdbcUtil;

public class Detail_add 
{
	private Connection conn = null;
	private PreparedStatement ps = null;
	private ResultSet rs = null;
	
	public Detail_add()
	{
		conn = JdbcUtil.getConnection();
		String table = "detail_info";
		String sql = "insert into "+table+" values(?,?,?,?,?,?,?,?)";
		
		try {
			ps = conn.prepareStatement(sql);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}
	public void add(String MA,String PA,String PRIMAR,String MIDDLE,String HIGH,String FOOD,String NAME,int SchID)
	{
		try {
			ps.setString(1, MA);
			ps.setString(2, PA);
			ps.setString(3, PRIMAR);
			ps.setString(4, MIDDLE);
			ps.setString(5,HIGH);
			ps.setString(6,FOOD);
			ps.setString(7,NAME);
			ps.setInt(8,SchID);
			ps.executeUpdate();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		finally
		{
			JdbcUtil.release(conn,ps, rs);
		}		
	}
}
